<?php

namespace app\api\controller;

use app\common\controller\Api;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 随机图
     *
     */
    public function getpicture()
    {
        $url = db('note_picture')->where('status',1)->orderRaw('rand()')->value('src');
        Header("Location:$url");
    }

    /**
     * 配置文件
     *
     */
    public function config()
    {
        $config = db('config')->column('name,value','name');
        $this->success('获取成功',[
            'wxLogin'=>$config['wxLogin'],
            'searchTis'=>$config['searchTis'],
            'WeChatStatus'=>$config['WeChatStatus'],
            'errorImg'=>$config['errorImg'],
            'errorTis'=>$config['errorTis']
        ]);
    }
}
